#ifndef SCENEOBJECT_H
#define SCENEOBJECT_H
#include <glm/glm.hpp>
#include <QString>
#include <QDataStream>



class SceneObject
{

	friend QDataStream & operator>> (QDataStream & inStream, SceneObject & object);
	friend QDataStream & operator<< (QDataStream & outStream, SceneObject & object);

public:

	SceneObject();

	~SceneObject();

	glm::vec3 getLoc () const;
	void setLoc (const glm::vec3 & loc);

	void setName (const QString & name);
	QString getName () const;

	void setId (unsigned int id);
	unsigned int getId () const;

	void setColor (const glm::vec3 & color);
	glm::vec3 getColor () const;

	void setSelected (bool isSelected);
	bool isSelected () const;

	void setVisible (bool isVisible);
	bool isVisible () const;

	virtual void render () {}

	void rotate (int axis, float angle);

	void scale (int axis, float ratio);

	void applyPreview ();

	glm::mat4 getPreviewRotateMatrix () const;

	glm::mat4 getPreviewScaleMatrix () const;

private:
	
	glm::vec3 _loc;

	QString _name;

	unsigned int _id;

	glm::vec3 _color;

	bool _selected;

	bool _isVisible;

	float _previewRotateAngle[3];

	float _previewScale[3];

	virtual void _applyRotateMatrix () = 0;

	virtual void _applyScaleMatrix () = 0;

};

QDataStream & operator>> (QDataStream & inStream, SceneObject & object);

QDataStream & operator<< (QDataStream & outStream, SceneObject & object);

#endif // SCENEOBJECT_H
